// eslint-disable-next-line @typescript-eslint/no-var-requires
const CompressionPlugin = require('compression-webpack-plugin')
module.exports = {
  configureWebpack: config => {
    config.externals = {}
    return {
      plugins: [
        new CompressionPlugin({
          test: /.js$|.html$|.css$|.map/,
          // 匹配文件名
          threshold: 10240,
          // 对超过10k的数据进行压缩                        、
          deleteOriginalAssets: false, //是否删除原文件
        }),
      ],
    }
  },
  devServer: {
    open:true,
    proxy: {
      '/api': {
        target: 'http://localhost:8090/admin_war',
        // target: 'http://3e8d080440.wicp.vip/admin_war',
        // target: 'http://36v5p52930.wicp.vip/admin_war',
        // target: 'http://192.168.139.23:8080/admin_war',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/',
        },
      },
      '/file': {
        target: 'http://localhost:8091',
        changeOrigin: true,
        pathRewrite: {
          '^/file': '/',
        },
      }
    },
  },
}
